<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise加载script脚本</title>
</head>
<body>
    <script>
        function loadScript(src){
            return new Promise((resolve,reject) => {
                const script = document.createElement("script");
                script.src = src;
                script.onload = () => {
                    resolve(script)
                };
                script.onerror = reject;
                document.body.appendChild(script);
            });
        }

        loadScript('./285-hd.js').then(
            value => {
                return loadScript('./285-houdunren.js');
            }
        ).then(
            value =>{
                user();
            }
        )
    </script>
</body>
</html>